#include <iostream>
#include <vector>

using namespace std;
#include "vector.h"

void test1()
{
	ly::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);

	ly::vector<int>::iterator it = v.begin();
	while (it != v.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;
	cout << v.capacity() << endl;
	cout << v.size() << endl;

	v.pop_back();
	v.pop_back();
	v.pop_back();
	v.pop_back();
	v.pop_back();

	v.resize(10);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
	cout << v.capacity() << endl;
	cout << v.size() << endl;

	v.resize(2);
	cout << v.capacity() << endl;
	cout << v.size() << endl;
}

void test2()
{
	ly::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);

	ly::vector<int>::iterator pos = v.begin() + 3;
	v.insert(pos, 40);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	pos = v.begin() + 3;
	v.erase(pos);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
}

void test3()
{
	ly::vector<int> v(10, 1);
	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;
	cout << v.capacity() << endl;
	cout << v.size() << endl;
}


void test4()
{
	ly::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);
	v.push_back(7);

	ly::vector<int> v1(v.begin(), v.end());
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
	cout << v1.size() << endl;
	cout << v1.capacity() << endl;
}

void test5()
{
	ly::vector<int> v;
	v.push_back(1);
	v.push_back(2);
	v.push_back(3);
	v.push_back(4);
	v.push_back(5);
	v.push_back(6);
	v.push_back(7);

	ly::vector<int> v1(v);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
	cout << v1.capacity() << endl;
	cout << v1.size() << endl;

	ly::vector<int> v2;
	v2 = v;
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
	cout << v2.capacity() << endl;
	cout << v2.size() << endl;
}

void test6()
{
	ly::vector<string> v;
	v.push_back("11111111111111");
	v.push_back("11111111111111");
	v.push_back("11111111111111");
	v.push_back("11111111111111");
	v.push_back("11111111111111");

	for (auto e : v)
	{
		cout << e << " ";
	}
	cout << endl;

	ly::vector<string> v1(v);
	for (auto e : v1)
	{
		cout << e << " ";
	}
	cout << endl;
}

int main()
{
	test6();

	return 0;
}

//void test1()
//{
//	int* a = new int[10] {1, 2, 3, 4, 5, 6, 7, 8, 9, 0};
//	int* b = new int[10] {0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
//
//	memcpy(b, a, sizeof(int) * 10);
//	delete[] a;
//	delete[] b;
//}